﻿@using Fap.Core.Extensions
@model AttentionModel
@{
    int todoCount = Model.TodoCount;
    int agentCount = Model.AgentCount;
    int total = todoCount + agentCount;
    string todoPer = "0%";
    string agentPer = "0%";
    if (total > 0)
    {
        if (todoCount > 0)
        {
            todoPer = todoCount * 100 / total + "%";
        }
        if (agentCount > 0)
        {
            agentPer = agentCount * 100 / total + "%";
        }

    }
}
<li class="grey">
    <a data-toggle="dropdown" class="dropdown-toggle" href="#">
        <i class="ace-icon fa fa-tasks"></i>
        <span class="badge badge-grey handingcount">@total</span>
    </a>

    <ul id="todotasklist" class="dropdown-menu-right dropdown-navbar dropdown-menu dropdown-caret dropdown-close">
        <li class="dropdown-header">
            <i class="ace-icon fa fa-check"></i>
            <span class="hanglingtxt"><b>@total</b><fap-multilang lang-key="pending_tasks" default-content="待处理任务"></fap-multilang></span>
        </li>

        <li class="dropdown-content">
            <ul class="dropdown-menu dropdown-navbar">
                <li id="todocounter">
                    <a href="@Url.Content("~/Home/MainFrame#Workflow/Business/TodoTask")">
                        <div class="clearfix">
                            <span class="pull-left"><fap-multilang lang-key="my_pending_tasks" default-content="我的待处理任务"></fap-multilang></span>
                            <span class="pull-right percent">@todoCount </span>
                        </div>

                        <div class="progress progress-mini">
                            <div style="width:@todoPer" class="progress-bar"></div>
                        </div>
                    </a>
                </li>
                <li id="agentcounter">
                    <a href="@Url.Content("~/Home/MainFrame#Workflow/Business/AgentTask")">
                        <div class="clearfix">
                            <span class="pull-left"><fap-multilang lang-key="my_agent_tasks" default-content="我的代理任务"></fap-multilang></span>
                            <span class="pull-right percent">@agentCount</span>
                        </div>

                        <div class="progress progress-mini">
                            <div style="width:@agentPer" class="progress-bar"></div>
                        </div>
                    </a>
                </li>
            </ul>
        </li>

        <li class="dropdown-footer">
            <a href="@Url.Content("~/Home/MainFrame#Workflow/Business/DoneTask")">
                <fap-multilang lang-key="show_all" default-content="查看所有"></fap-multilang>
                <i class="ace-icon fa fa-arrow-right"></i>
            </a>
        </li>
    </ul>
</li>


<li class="purple">

    <a data-toggle="dropdown" class="dropdown-toggle" href="#">
        <i class="ace-icon fa fa-bell icon-animated-bell"></i>
        <span class="badge badge-important">@Model.Notifications.Count()</span>
    </a>

    <ul class="dropdown-menu-right dropdown-navbar navbar-pink dropdown-menu dropdown-caret dropdown-close">
        <li class="dropdown-header">
            <i class="ace-icon fa fa-exclamation-triangle"></i>
            @Model.Notifications.Count() <fap-multilang lang-key="notifications" default-content="通知"></fap-multilang>
        </li>

        <li class="dropdown-content">
            <ul class="dropdown-menu dropdown-navbar navbar-pink">
                @foreach (var notification in Model.Notifications)
                {
                    <li>
                        <a href="~/Home/MainFrame#@notification.NavigateUrl">
                            <div class="clearfix">
                                <span class="pull-left">
                                    <i class="btn btn-xs no-hover  fa @notification.Icon"></i>
                                    @notification.Description
                                </span>
                                <span class="pull-right badge badge-yellow">+@notification.NCount</span>
                            </div>
                        </a>
                    </li>
                }
            </ul>
        </li>
        <li class="dropdown-footer">

        </li>
    </ul>
</li>

<li class="green">
    <a data-toggle="dropdown" class="dropdown-toggle" href="#">
        <i class="ace-icon fa fa-envelope icon-animated-vertical"></i>
        <span class="badge badge-success">@Model.Messages.Count()</span>
    </a>

    <ul class="dropdown-menu-right dropdown-navbar dropdown-menu dropdown-caret dropdown-close">
        <li class="dropdown-header">
            <i class="ace-icon fa fa-envelope-o"></i>
            @Model.Messages.Count()  <fap-multilang lang-key="message" default-content="消息"></fap-multilang>
        </li>

        <li class="dropdown-content">
            <ul class="dropdown-menu dropdown-navbar">
                @foreach (var message in Model.Messages)
                {
                    string target = string.Empty;
                    string href = "javascript:void(0)";
                    if (message.URL.IsPresent())
                    {
                        target = "target=_blank";
                        href = message.URL;
                    }
                    <li>
                        <a @target href="@href">
                            <div class="clearfix">
                                <div class="pull-left">
                                    <i class="ace-icon fa fa-volume-up  bigger-150 text-muted"></i>
                                </div>
                                <span class="msg-body">
                                    <span class="msg-title">
                                        <span class="blue">@message.Title:</span>
                                        @message.MsgContent
                                        @if (message.URL.IsPresent())
                                        {
                                            <i class="ace-icon fa fa-hand-o-right green bigger-120"></i>
                                        }
                                    </span>

                                    <span class="msg-time">
                                        <i class="ace-icon fa fa-clock-o"></i>
                                        <span>@message.SendTime</span>
                                    </span>
                                </span>
                            </div>
                        </a>
                    </li>
                }
            </ul>
        </li>

        <li class="dropdown-footer">
            <a href="@Url.Content("~/Home/MainFrame#SelfService/Ess/MessageAndNotice")">
                <fap-multilang lang-key="show_all" default-content="查看所有"></fap-multilang>
                <i class="ace-icon fa fa-arrow-right"></i>
            </a>
        </li>
    </ul>
</li>



